ci: keep build timing report non-blocking when PR comment fails - #592
Conversation
The "Upsert build timing PR comment" step throws on any GitHub API error, which fails the whole Build Timing Report job. In practice the comment call returns HTTP 403 "Resource not accessible by integration": this is a `workflow_run` job, so GITHUB_TOKEN is capped at the repository's default token permissions and the `issues: write` declared in the workflow cannot take effect. The rendered report is already attached to the job summary, so the comment is cosmetic, yet the failure shows up as a red X on green CI. Wrap the comment upsert in try/catch: on failure emit a core.warning (with a pointer to the Actions workflow-permission setting on 403) and let the job finish green. No behavior change when the comment posts successfully. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🤖 PR SummaryThis PR contains a single change: it adjusts the GitHub Actions workflow for the build timing report ( Statistics
Lean Declarations
📋 **Additional Analysis**No findings. 📄 **Per-File Summaries**
Last updated: 2026-07-22 23:31 UTC. |
|
Thanks for diagnosing the noisy failure. I’d like to retain the PR comment, so please revise this PR to incorporate the permission correction while keeping the reporting step resilient:
I’ve closed #632 in favor of consolidating both fixes here. |
|
Addressed in c60e387. Changes made:
Local checks run:
The lightweight PR checks have passed; the full build/docs jobs are still in progress. |
Grant the Build Timing Report job the permissions it uses: `actions: read`, `contents: read`, and `pull-requests: write`. Scope them to the `report` job and remove the redundant `issues` permission. Keep expected PR comment API failures (HTTP 403, 404, 410, 422, and 429) non-blocking while recording the status and message and preserving the rendered report in the job summary. Unexpected JavaScript errors and unexpected HTTP statuses still fail. Consolidates the permission fix from #632.
Summary
Build Timing Reportreportjob the token permissions it actually uses:actions: read,contents: read, andpull-requests: write.issues: write/pull-requests: readblock, and scope the requested permissions to the reporting job.Context
The report renderer succeeds, but the final comment-upsert step can fail with:
#632 identified the permission side of the same failure: for comments on pull requests, the workflow should request
pull-requests: write. This PR now folds that permission correction into the existing resilience work, while keeping the rendered timing report available through$GITHUB_STEP_SUMMARYif GitHub still rejects the comment API call.The updated diagnosis is that the workflow should request the correct job-level
GITHUB_TOKENscope directly. If an organization/repository setting or rate limit still prevents the comment operation, the workflow emits a warning containingHTTP <status>: <message>and does not turn an otherwise-green CI run red for the cosmetic comment.Verification
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/build-timing-report.yml'))"git diff --checkUpsert build timing PR commentgithub-scriptbody and syntax-checked it with bundled Node after wrapping it in an async function.Posted by Codex on behalf of the user (@ainta) with approval.